//
//  AppDelegate.m
//  AVAudioRecoder
//
//  Created by Xwoder on 17/2/2.
//  Copyright © 2017年 Xwoder. All rights reserved.
//

#import "AppDelegate.h"
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // 配置音频会话
    AVAudioSession *session = [AVAudioSession sharedInstance];
    
    // AVAudioSessionCategoryRecord:
    // The category for recording audio; this category silences playback audio.
    
    // AVAudioSessionCategoryPlayAndRecord:
    // The category for recording (input) and playback (output) of audio, such as for a VoIP (Voice over Internet Protocol) app.
    
    if ([session setCategory:AVAudioSessionCategoryPlayAndRecord error:NULL]) {
        // code...
    } else {
        // code...
    }
    
    if ([session setActive:YES error:NULL]) {
        // code...
    } else {
        // code...
    }
    
    
    UIWindow *window = [[UIWindow alloc] init];
    window.frame = [UIScreen mainScreen].bounds;
    window.rootViewController = [[ViewController alloc] init];
    [window makeKeyAndVisible];
    self.window = window;
    
    return YES;
}

@end
